<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>

<head lang="en">

    <meta charset="UTF-8">
    <title>App信息管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<%@include file="/WEB-INF/pages/common/srcjs.jsp" %>

<%--头部--%>
<body class="layui-layout-body">
<%@include file="/WEB-INF/pages/header.jsp" %>
    <%--中间内容--%>
    <div class="layui-body" style="background-color: burlywood">

        <div style="padding: 10px;padding-top: 0px">

            <div style="border:1px solid #DEB887;">
                <table class="layui-table">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>

                    <tr style="background-color:black;color: white;">

                        <th><strong style="font-size: 20px;">App信息管理维护&nbsp;&nbsp; <i
                                class="layui-icon layui-icon-username"
                                style="font-size:15px;"></i></strong><span
                                style="color: #9d9d9d">&nbsp;&nbsp;用户名&nbsp;&nbsp;您可以对选项进行选择筛选App信息</span></th>

                    </tr>

                    </thead>

                </table>

                <form class="layui-form" action="app/list" method="post" style="padding-left: 55px;">
                    <input type="hidden" id="pageIndex" name="pageIndex" value="1">

                    <table>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">软件名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="softwareName" id="softwareName"  lay-verify="required"
                                               placeholder="请输入App名称" autocomplete="off" class="layui-input"></div>
                                </div>
                            </td>

                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">App状态</label>
                                    <div class="layui-input-block">
                                        <select name="status" lay-verify="required" id="status">
                                            <option value="">请选择</option>
                                            <c:forEach items="${statusList}" var="sList" varStatus="status">
                                                <option value="${sList.id}">${sList.valueName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">所属平台</label>
                                    <div class="layui-input-block">
                                        <select name="flatformId" lay-verify="required" id="flatformId">
                                            <option value="">请选择</option>
                                            <c:forEach items="${flatformNameList}" var="flatList" varStatus="status">
                                                <option value=" ${flatList.id}">${flatList.valueName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">一级分类</label>
                                    <div class="layui-input-block">
                                        <select name="categoryLevel1" id="categoryLevel1" lay-verify="required" lay-filter="myselect">
                                            <option value="">请选择</option>
                                            <c:forEach items="${categoryLevel1List}" var="cate1List" varStatus="status">
                                                <option value=" ${cate1List.id}">${cate1List.categoryName}</option>
                                            </c:forEach>

                                        </select>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">二级分类</label>
                                    <div class="layui-input-block">
                                        <select name="categoryLevel2" id="categoryLevel2" lay-verify="required" lay-filter="myselect2">
                                            <option value=""></option>
                                            <option value="0">待定</option>
                                        </select>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">三级分类</label>
                                    <div class="layui-input-block">
                                        <select name="categoryLevel3" id="categoryLevel3" lay-verify="required">
                                            <option value=""></option>
                                            <option value="0">待定</option>
                                        </select>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>

                        </tr>
                    </table>

                </form>
                <td style="padding-left: 20px;padding-bottom: 10px;">
                    <button class="layui-btn" style="background-color:black;"><a onclick="search()" style="color:white">查&nbsp;&nbsp;询</a>
                    </button>
                </td>
            </div>
            <%--查询结束--%>

            <table class="layui-table" id="index">
                <colgroup>
                    <col width="150">
                    <col width="200">
                    <col>
                </colgroup>

                <tr id="indexs">
                    <th>软件名称</th>
                    <th>APK名称</th>
                    <th>软件大小(单位M)</th>
                    <th>所属平台</th>
                    <th>所属分类(一级分类，二级分类，三级分类)</th>
                    <th>状态</th>
                    <th>下载次数</th>
                    <th>最新版本号</th>
                    <th>操作</th>
                </tr>

            </table>
            <a href="javascript:void(0)" onclick="PageChange(10)" class="layui-btn layui-btn-sm layui-btn-primary">首页</a>
            <a href="javascript:void(0)" onclick="PageChange(1)" class="layui-btn layui-btn-sm layui-btn-primary">上一页</a>
            <a href="javascript:void(0)" onclick="PageChange(-1)" class="layui-btn layui-btn-sm layui-btn-primary">下一页</a>
            <a href="javascript:void(0)" onclick="PageChange(-10)" class="layui-btn layui-btn-sm layui-btn-primary">末页</a>

        </div>
        <div style="position: fixed;visibility:hidden;">
            <div id="addappinfo">
                <form action="" method="post">
                    <table align="center" width="450px" style="height: 550px">
                        <input type="hidden" class="ids" value="${appInfo.id}"/>
                        <tr>
                            <td>软件名称*</td>
                            <td><input type="text" name="softwareNames" placeholder="请输入App名称" class="layui-input softwareNames"
                                       value="${appInfo.softwareName}"  ></td>
                        </tr>
                        <tr>
                            <td>APK名称*</td>
                            <td><input type="text" name="aPKNames" <c:if test="${appInfo.aPKName!=null}">disabled</c:if> placeholder="请输入APK名称" class="layui-input aPKNames"value="${appInfo.aPKName}"></td>
                        </tr>
                        <tr>
                            <td>支持ROM*</td>
                            <td><input type="text" name="supportROMs" placeholder="请输入支持的ROM" class="layui-input supportROMs" value="${appInfo.supportROM}">
                            </td>
                        </tr>
                        <tr>
                            <td>界面语言*</td>
                            <td><input type="text" name="interfaceLanguages" placeholder="请输入软件支持的界面语言" class="layui-input interfaceLanguages"
                                       value="${appInfo.interfaceLanguage}"  ></td>
                        </tr>
                        <tr>
                            <td>软件大小*</td>
                            <td><input type="text" name="softwareSizes" placeholder="请输入软件大小，单位为Mb" class="layui-input softwareSizes"
                                       value="${appInfo.softwareSize}"   ></td>
                        </tr>
                        <tr>
                            <td>下载次数*</td>
                            <td><input type="text" name="downloadss" placeholder="请输入下载次数" class="layui-input downloadss" value="${appInfo.downloads}"></td>
                        </tr>
                        <tr>
                            <td>所属平台*</td>
                            <td>
                                <select name="flatformIds"class="layui-input flatformIds">
                                    <option value="">请选择</option>
                                    <c:forEach items="${flatforms}" var="a">
                                        <option <c:if test="${a.valueId==appInfo.flatformId}">selected</c:if> value=${a.valueId}>${a.valueName}</option>
                                    </c:forEach>
                                </select>
                            </td>
                        </tr>
                        <c:if test="${backendUser==null}">
                            <tr>
                                <td>一级分类*</td>
                                <td>
                                    <select name="categoryLevel1s"class="layui-input categoryLevel1s" onchange="changeLevel1s1s(this)">
                                        <option value="">请选择</option>
                                        <c:forEach items="${appCategorylist}" var="a">
                                            <option <c:if test="${a.id==appInfo.categoryLevel1}">selected</c:if> value=${a.id}>${a.categoryName}</option>
                                        </c:forEach>

                                    </select>

                                </td>
                            </tr>
                            </tr>
                            <tr>
                                <td>二级分类*</td>
                                <td>

                                    <select name="categoryLevel2s" id="categoryLevel2s" class="layui-input categoryLevel2s" onchange="changeLevel1s2s(this)">
                                        <option value="">请选择</option>
                                        <c:forEach items="${getCategoryLevel2}" var="b">
                                            <option <c:if test="${b.id==appInfo.categoryLevel2}">selected</c:if> value=${b.id}>${b.categoryName}</option>
                                        </c:forEach>
                                    </select>

                                </td>
                            </tr>
                            </tr>
                            <tr>
                                <td>三级分类*</td>
                                <td>

                                    <select name="categoryLeve3s" id="categoryLevel3s" class="layui-input categoryLevel3s">
                                        <option value="">请选择</option>
                                        <c:forEach items="${getCategoryLevel3}" var="c">
                                            <option <c:if test="${c.id==appInfo.categoryLevel3}">selected</c:if> value=${c.id}>${c.categoryName}</option>
                                        </c:forEach>
                                    </select>

                                </td>
                            </tr>
                        </c:if>
                        <c:if test="${backendUser!=null}"> <tr>
                            <td>所属分类*</td>

                            <td><input type="text" disabled name="" class="layui-input" value="${appInfo.categoryLevel1Name}》${appInfo.categoryLevel2Name}》${appInfo.categoryLevel3Name}"></td>

                        </tr></c:if>
                        <tr>
                            <td>APP状态*</td>

                            <td><input type="text" disabled name="" class="layui-input " value="<c:if test='${appInfo.statusName==null}'>待审核</c:if>${appInfo.statusName}"></td>
                            <input type="hidden" disabled name="" class="layui-input status" value="<c:if test='${appInfo.status==null}'>1</c:if>${appInfo.status}">

                        </tr>
                        <tr>
                            <td>应用简介*</td>
                            <td><textarea id="appInfos" rows="2" cols="45" class="layui-input appInfos" required>
                                ${appInfo.appInfo}
                            </textarea></td>
                        </tr>
                        <%--<tr>--%>

                        <%--<td>    <img src="${appInfo.logoPicPath}" />${appInfo.logoPicPath}</td>--%>
                        <%--</tr>--%>
                        <tr>

                            <td>LOGO图片*</td>
                            <td><input id="logoPicPaths" type="file" class="layui-input logoPicPaths"></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div id="addappversion">
                <div id="addappversionls">
                    <h3>历史版本列表</h3>
                    <hr/>
                    <table align="center" class="layui-table appVersionind" id="appVersionind">
                        <tr id="appVersioninds" class="appVersioninds">
                            <td>软件名称</td>
                            <td>版本号</td>
                            <td>版本大小(单位大小：M)</td>
                            <td>发布状态</td>
                            <td>APK文件下载</td>
                            <td>最新更新时间</td>
                        </tr>
                        <tr>
                            <c:forEach items="${appVersionList}" var="i">
                        <tr>
                            <td>${i.appName}</td>
                            <td>${i.versionNo}</td>
                            <td>${i.versionSize}</td>
                            <td>${i.publishStatusName}</td>
                            <td>${i.apkFileName}</td>
                            <td>${i.modifyDate}</td>
                        </tr>
                        </c:forEach>
                        <%--<c:forEach items="${appVersionList.appVersionList}" var="i">--%>
                        <%--<tr>--%>
                        <%--<td>${i.appName}</td>--%>
                        <%--<td>${i.versionNo}</td>--%>
                        <%--<td>${i.versionSize}</td>--%>
                        <%--<td>${i.publishStatusName}</td>--%>
                        <%--<td>${i.apkFileName}</td>--%>
                        <%--<td>${i.modifyDate}</td>--%>
                        <%--</tr>--%>
                        <%--</c:forEach>--%>
                        </tr>
                    </table>
                </div>
                <div id="AppVersionindo">
                    <h3>新增APP版本信息</h3>
                    <hr/>

                    <table width="500px" style="height:200px;margin: auto">
                        <tr>
                            <td>版本号*</td>
                            <td><input type="text" id="versionNo" value="${appVersion.versionNo}" class="layui-input versionNo" placeholder="请输入版本号"/></td>
                            <%--<input type="hidden"  value="${appVersion.appId}" class="appId"/>--%>
                            <input type="hidden"  value="${appVersion.id}" class="versionId"/>
                            <input type="hidden"  value="${appid}" class="appIds"/>
                            <input type="hidden"  value="${appVersion.appId}" class="appId"/>
                        </tr>
                        <tr>
                            <td>版本大小*</td>
                            <td><input type="text" id="versionSize" value="${appVersion.versionSize}" class="layui-input versionSize" placeholder="请输入版本大小，单位为Mb"/></td>
                        </tr>
                        <tr>
                            <td>发布状态*</td>
                            <td >预发售</td>
                        </tr>
                        <tr>
                            <td>版本简介*</td>
                            <td><textarea id="versionInfo" class="layui-input versionInfo" rows="2" placeholder="请输入本版本相关信息，本信息作为该版本的详细信息进行版本介绍" class="layui-input versionInfo" required>${appVersion.versionInfo}</textarea></td>
                        </tr>
                        <tr>
                            <td>apk文件*</td>

                            <td><c:if test="${appVersion.apkFileName==null}"><input id="apkFileName" type="file" class="layui-input apkFileName"></c:if>
                                <c:if test="${appVersion.apkFileName!=null}"><input id="apkFileName" type="text" disabled value="${appVersion.apkFileName}" class="layui-input apkFileName"></c:if></td>
                        </tr>

                    </table>
                </div>
            </div>
        </div>
        <input type="hidden" id="userId" value="${devUser.id}">
</body>
<script type="text/javascript">
    //三级联动代码块
    layui.use(['jquery', 'layer', 'form'], function () {
        var $$ = layui.$ //重点处
            , layer = layui.layer, form = layui.form
            , pageNo = 1, pageCount = 0;//,softwareName,status,flatformId,categoryLevel1,categoryLevel2,categoryLevel3;

        window.Soso= function () {

            search();
        }


        $(function () {
            search();

            if(${staff=="update"}){
                appAppVersion();
                updateAppInfo();
            }if(${staff=="AddAppInfo"}){
                appAppVersion();
                addAppInfo();
            }if(${staff=="index"}){
                appAppVersion();
            }if(${appVersiondappid=="addappVersionappid"}){
                appAppVersion();
                addappversion();
            }
            if(${ShowupdateVersionList=="ShowupdateVersionList"}){
                appAppVersion();
                updateappversion();
            }if(${ShowaddAppInfoAppVersion=="ShowaddAppInfoAppVersion"}){
                appAppVersion();
                ShowaddAppInfoAppVersion();
            }
            if(${ShowAppVersionAppInfo=="ShowAppVersionAppInfo"}){
                appAppVersion();
                auditing();
            }
        });

        //页面刷新
        function search() {
            var $softwareName = $$("#softwareName").val();
            var $status = $$("#status").val();
            var $flatformId = $$("#flatformId").val();
            var $categoryLevel1 = $$("#categoryLevel1").val();
            var $categoryLevel2 = $$("#categoryLevel2").val();
            var $categoryLevel3 = $$("#categoryLevel3").val();

            $.ajax({
                "url": "app/AppInfoList",
                "type": "POST",
                "data": "pageNo=" + pageNo + "&softwareName=" + $softwareName + "&status=" + $status + "&flatformId=" + $flatformId + "&categoryLevel1=" + $categoryLevel1 + "&categoryLevel2=" + $categoryLevel2 + "&categoryLevel3=" + $categoryLevel3,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    pageCount = data.pages.totalPageCount;
                    $("#indexs").siblings().remove();
                    var $html;
                    var datas = data.AppInfoList;
                    for (var i = 0; i < datas.length; i++) {
                        var $opera;
                        if(${backendUser==null}){
                            $opera="<select onchange='operation(this," + datas[i].id + ")'" + " style='background-color: black;color: white;padding-bottom: 3px'>"
                                + "<option value=''>点击操作</option>"
                                + "<option value=1>新增版本</option>"
                                + "<option value=2>修改版本</option>"
                                + "<option value=3>下架</option>"
                                + "<option value=4>修改</option>"
                                + "<option value=5>查看</option>"
                                + "<option value=6>删除</option>"
                                + "</select></td>"

                        }else{
                            $opera="<button class='layui-btn' style='background-color:black;'><a "
                                +"href='javascript:void(0)' onclick='AppVersionlistAppInfo("+ datas[i].id +")' style='color:white'>审&nbsp;&nbsp;核</a> </button>";
                        }
                        $html = ("<tr><td>" + datas[i].softwareName + "</td>"
                        + "<td>" + datas[i].aPKName + "</td>"
                        + "<td>" + datas[i].softwareSize + "</td>"
                        + "<td>" + datas[i].flatformName + "</td>"
                        + "<td>" + datas[i].categoryLevel1Name + "》" + datas[i].categoryLevel2Name + "》" + datas[i].categoryLevel3Name + "</td>"
                        + "<td>" + datas[i].statusName + "</td>"
                        + "<td>" + datas[i].downloads + "</td>"
                        + "<td>" + datas[i].versionNo + "</td>"
                        + "<td>"+$opera+"<tr>");
                        $("#index").append($html);
                    }
                }
            });

        }

        //分页功能
        window.PageChange = function (CurrentPageNo) {
            if (CurrentPageNo == 1) {//上一页
                pageNo = pageNo - 1;
            } else if (CurrentPageNo == -1) {//下一页
                pageNo = pageNo + 1;
            } else if (CurrentPageNo == 10) {//首页
                pageNo = 1;
            } else if (CurrentPageNo == -10) {//末页
                pageNo = pageCount;
            } else if (CurrentPageNo == 0) {//查询
                pageNo = 1;
            }
            if (pageNo < 1) {
                pageNo = 1;
            } else if (pageNo > pageCount) {
                pageNo = pageCount;
            }

            if (pageNo >= 1 && pageNo <= pageCount) {
                search();
            }
        };
        //删除
        function deletesId(node, inId) {
            if (window.confirm("确定删除这条信息吗？")) {
                var $node = $$(node);
                $.ajax({
                    "url": "app/deleteAppInfo",
                    "data": "inId=" + inId,  //请求参数
                    "dataType": "json",  //放回值类型
                    "success": function (data) {    //请求成功之后的回调函数
                        if (data > 0) {
                            $node.parent().parent().remove();
                            search();
                        } else {
                            alert("删除失败！");
                        }
                    }
                });
            }


        }
        //下架操作
        function lowerShelf(node, inId) {
            if (window.confirm("确定下架这款 App吗？")) {
                $.ajax({
                    "url": "app/AppInfoLowerShelf",
                    "data": "inId=" + inId,  //请求参数
                    "dataType": "json",  //放回值类型
                    "success": function (data) {    //请求成功之后的回调函数
                        if (data > 0) {
                            alert("下架成功");
                            search();
                        } else {
                            alert("下架失败！");
                        }
                    }
                });
            }
        }
        //操作判断
        window.operation = function (node, idNo) {

            switch (node.value) {
                case '1':
                    window.location.href="AppVersionList?appid="+idNo;
                    break;
                case '2':
                    AppVersionlist(idNo);
                    break;
                case '3':
                    lowerShelf(node, idNo);
                    break;
                case '4':
                    window.location.href="app/AppInfoId?noid="+idNo;
                    break;
                case '5':
                    window.location.href="ShowaddAppInfoAppVersion?appId="+idNo;
                    break;
                case '6':
                    deletesId(node, idNo);
                    break;
            }

        }
        //三联级
        function selects(idNo, node) {
            $.ajax({
                "url": "appcategory",
                "data": "ids=" + idNo,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    var $datas = $(data);
                    var $html;
                    var $option = "<option value=''>请选择</option>";
                    for (var i = 0; i < $datas.length; i++) {
                        $html = "<option value=" + $datas[i].id + ">" + $datas[i].categoryName + "</option>";
                        $option = $option + $html;
                    }
                    node.html($option);
                    form.render('select');
                }
            });
        }
        //一级条件触发
        form.on('select(categoryLevel1)', function (data) {
            var $$val = data.value;
            selects($$val, $("#categoryLevel2"));
        });
        //二级条件触发
        form.on('select(categoryLevel2)', function (data) {
            var $$val = data.value;
            selects($$val, $("#categoryLevel3"));
        });
        /**   <%--function changeLevel1s1s(data){--%>
         <%--var $$val = data.value;--%>
         <%--var $nosd= $$(".categoryLevel2s").get(1);--%>
         <%--$.ajax({--%>
         <%--"url": "appcategory",--%>
         <%--"data": "ids=" + $$val,//请求参数--%>
         <%--"dataType": "json",  //放回值类型--%>
         <%--"success": function (data) {--%>
         <%--var $datas = $(data);--%>
         <%--var $html;--%>
         <%--var $option = "<option value=''>请选择</option>";--%>
         <%--for (var i = 0; i < $datas.length; i++) {--%>
         <%--var idds=$datas[i].id==${appInfo.categoryLevel2}?"selected":"";--%>
         <%--$html = "<option  "+idds+" value='" + $datas[i].id + "'>" + $datas[i].categoryName + "</option>";--%>
         <%--$option = $option + $html;--%>
         <%--}--%>
         <%--$nosd.innerHTML=$option;--%>
         <%--changeLevel1s2s(${appInfo.categoryLevel3});--%>
         <%--}--%>
         <%--});--%>
         <%--}--%>**/
        //弹窗一级条件触发
        window.changeLevel1s1s = function (data) {
            var $$val = data.value;
            var $nosd= $$(".categoryLevel2s").get(1);
            $.ajax({
                "url": "appcategory",
                "data": "ids=" + $$val,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    var $datas = $(data);
                    var $html;
                    var $option = "<option value=''>请选择</option>";
                    for (var i = 0; i < $datas.length; i++) {
                        $html = "<option value=" + $datas[i].id + ">" + $datas[i].categoryName + "</option>";
                        $option = $option + $html;
                    }
                    $nosd.innerHTML=$option;
                }
            });
        }
        /**  <%--function changeLevel1s2s(data) {--%>

         <%--var $$val = data;--%>
         <%--alert($$val);--%>
         <%--alert("jin");--%>
         <%--var $nosd= $$(".categoryLevel3s").get(1);--%>
         <%--$.ajax({--%>
         <%--"url": "appcategory",--%>
         <%--"data": "ids=" + $$val,//请求参数--%>
         <%--"dataType": "json",  //放回值类型--%>
         <%--"success": function (data) {--%>
         <%--var $datas = $(data);--%>
         <%--var $html;--%>
         <%--var $option = "<option value=''>请选择</option>";--%>
         <%--for (var i = 0; i < $datas.length; i++) {--%>
         <%--alert(${appInfo.categoryLevel3});--%>
         <%--alert($datas[i].id);--%>
         <%--var idds=$datas[i].id==${appInfo.categoryLevel3}?"selected":"";--%>
         <%--alert(idds);--%>
         <%--$html = "<option "+idds+" value='" + $datas[i].id + "'>" +$datas[i].categoryName + "</option>";--%>
         <%--$option = $option + $html;--%>
         <%--}--%>
         <%--$nosd.innerHTML=$option;--%>
         <%--}--%>
         <%--});--%>
         <%--}--%>**/
        //弹窗二级条件触发
        window.changeLevel1s2s = function (data) {

            var $$val = data.value;
            var $nosd= $$(".categoryLevel3s").get(1);
            $.ajax({
                "url": "appcategory",
                "data": "ids=" + $$val,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    var $datas = $(data);
                    var $html;
                    var $option = "<option value=''>请选择</option>";
                    for (var i = 0; i < $datas.length; i++) {
                        $html = "<option value=" + $datas[i].id + ">" + $datas[i].categoryName + "</option>";
                        $option = $option + $html;
                    }
                    $nosd.innerHTML=$option;
                }
            });
        }
        //新增APP基础信息
        function addAppInfo() {
            var $heheh = $$("#addappinfo");
            layer.open({
                title: '新增APP基础信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()
                , anim: 2
                , area: ['500px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: ['保存', '返回']
                , btn1: function (index, layero) {
                    var $softwareName= $$(".softwareNames").get(1).value;

                    var $aPKName = $$(".aPKNames").get(1).value;

                    var $supportROM = $$(".supportROMs").get(1).value;

                    var $interfaceLanguage = $$(".interfaceLanguages").get(1).value;
                    var $softwareSize = $$(".softwareSizes").get(1).value;

                    var $downloads = $$(".downloadss").get(1).value;
                    //  alert($downloads);


                    var $flatformId = $$(".flatformIds").get(1).value;

                    var $categoryLevel1 = $$(".categoryLevel1s").get(1).value;

                    var $categoryLevel2 = $$(".categoryLevel2s").get(1).value;

                    var $categoryLevel3 = $$(".categoryLevel3s").get(1).value;

                    var $appInfo = $$(".appInfos").get(1).value;

                    var $logoPicPath = $$(".logoPicPaths").get(1).value;

                    $.ajax({
                        "url": "app/AddAppInfo",
                        "data":{"softwareName":$softwareName
                            ,"aPKName":$aPKName,"supportROM":$supportROM,"interfaceLanguage":$interfaceLanguage,
                            "softwareSize":$softwareSize,"flatformId":$flatformId,"downloads":$downloads,
                            "categoryLevel1":$categoryLevel1,"categoryLevel2":$categoryLevel2,"categoryLevel3":$categoryLevel3,"createdBy":userId,
                            "appInfo":$appInfo,"logoPicPath":$logoPicPath},//请求参数
                        "dataType": "json",  //放回值类型
                        "success": function (data) {
                            if(data>0){
                                alert("添加成功");
                                search();
                                layer.close(layer.index);
                            }else {
                                alert("添加失败");
                            }
                        }
                    });
                }, btn2: function (index, layero) {
                }

            });

        }
        //查看APP基本信息和版本信息
        function ShowaddAppInfoAppVersion() {
            var $heheh = $$("#addappinfo");
            var $addappversionls=$$("#addappversionls");
            $$("#addappinfo select,input,textarea").attr("disabled","disabled");
            layer.open({
                title: '查看APP基础信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()+$addappversionls.html()
                , anim: 2
                , area: ['6s50px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: ['返回']
                , btn1: function (index, layero) {
                    layer.close(layer.index);
                }
            });
        }
        var userId=$("#userId").val();
        //修改APP基础信息
        function updateAppInfoShow(appinfoid){
            var $ids= $$(".ids").get(1).value;
            var $softwareName= $$(".softwareNames").get(1).value;
            var $aPKName = $$(".aPKNames").get(1).value;
            var $supportROM = $$(".supportROMs").get(1).value;
            var $interfaceLanguage = $$(".interfaceLanguages").get(1).value;
            var $softwareSize = $$(".softwareSizes").get(1).value;
            var $downloads = $$(".downloadss").get(1).value;
            var $flatformId = $$(".flatformIds").get(1).value;
            var $categoryLevel1 = $$(".categoryLevel1s").get(1).value;
            var $categoryLevel2 = $$(".categoryLevel2s").get(1).value;
            var $categoryLevel3 = $$(".categoryLevel3s").get(1).value;
            var $appInfo = $$(".appInfos").get(1).value;
            var $logoPicPath = $$(".logoPicPaths").get(1).value;
            var $status= $$(".status").get(1).value;
            $.ajax({
                "url": "app/updateAppInfo",
                "data":{"softwareName":$softwareName
                    ,"aPKName":$aPKName,"supportROM":$supportROM,"interfaceLanguage":$interfaceLanguage,
                    "softwareSize":$softwareSize,"flatformId":$flatformId,"downloads":$downloads,
                    "categoryLevel1":$categoryLevel1,"categoryLevel2":$categoryLevel2,"categoryLevel3":$categoryLevel3,
                    "appInfo":$appInfo,"logoPicPath":$logoPicPath,"id":$ids,"modifyBy":userId,"status":$status,"appinfoid":appinfoid},//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    if(data>0){
                        alert("修改成功");
                        window.location.href="app/AppInfoId?noid=-1";
                    }else {
                        alert("修改失败");
                    }
                }
            });
        };
        function updateAppInfo(){
            var $heheh = $$("#addappinfo");
            var appinfoid=0;
            if(${appInfo.statusName=="审核未通过"}){
                var button=['保存并再次提交审核','保存', '返回'];

            }else {
                var button=['保存', '返回'];
                appinfoid=1;
            }

            layer.open({
                title: '修改APP基础信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()
                , anim: 2
                , area: ['500px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: button
                , btn1: function (index, layero) {
                    updateAppInfoShow(appinfoid);
                }, btn2: function (index, layero) {
                    if(${appInfo.statusName=="审核未通过"}){
                        updateAppInfoShow(appinfoid);
                    }else {
                        layer.close(layer.index);
                    }
                }, btn3: function (index, layero) {
                    layer.close(layer.index);
                }
            });
        }
//ajaxApp版本信息查询
        function  AppVersionlist(appvid) {

            $.ajax({
                "url": "versionList",
                "data": "appid=" + appvid,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    if(data>0){
                        window.location.href="ShowupdateVersionList?appId="+appvid;
                    }else{
                        alert("还没App有版本信息，请先添加App版本信息");
                    }

                }
            });
        }

        //测试历史
        /**<%--alert(appvid);--%>
         <%--alert("advdfdfdd");--%>
         <%--$.ajax({--%>
         <%--"url": "versionList",--%>
         <%--"data":{"appid":appvid},//请求参数--%>
         <%--"dataType": "json",  //放回值类型--%>
         <%--"success": function (data) {--%>
         <%--// $$(".appVersioninds").get(1).siblings().remove();--%>
         <%--&lt;%&ndash;<tr>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.appName}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.versionNo}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.versionSize}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.publishStatusName}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.apkFileName}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;<td>${i.modifyDate}</td>&ndash;%&gt;--%>
         <%--&lt;%&ndash;</tr>&ndash;%&gt;--%>
         <%--var $html;--%>
         <%--for(var i=0;i<data.length;i++){--%>
         <%--$html=$html+("<tr><td>"+data[i].appName+"</td>"--%>
         <%--+"<td>"+data[i].versionNo+"</td>"--%>
         <%--+"<td>"+data[i].versionSize+"</td>"--%>
         <%--+"<td>"+data[i].publishStatusName+"</td>"--%>
         <%--+"<td>"+data[i].apkFileName+"</td>"--%>
         <%--+"<td>"+data[i].modifyDate+"</td>");--%>
         <%--alert(data[i].versionSize);--%>


         <%--}--%>
         <%--$$(".appVersionind").get(1).innerHTML=$html;--%>
         <%--}--%>
         <%--});--%>
         <%--}--%>
         **/
//添加App版本信息
        function addappversion(appid) {
            var $heheh = $$("#addappversion");
            layer.open({
                title: '新增APP版本信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()
                , anim: 2
                , area: ['6s00px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: ['保存', '返回']
                , btn1: function (index, layero) {
                    var $versionNo= $$(".versionNo").get(1).value;
                    var $versionSize = $$(".versionSize").get(1).value;
                    var $versionInfo= $$(".versionInfo").get(1).value;
                    var $apkFileName= $$(".apkFileName").get(1).value;
                    var $appIds= $$(".appIds").get(1).value;
                    $.ajax({
                        "url": "addAppVersion",
                        "data":{"versionNo":$versionNo,"versionSize":$versionSize,"versionInfo":$versionInfo,"apkFileName":$apkFileName,"createdBy":userId,"appId":$appIds},//请求参数
                        "dataType": "json",  //放回值类型
                        "success": function (data) {
                            if(data>0){
                                alert("添加成功");
                                search();
                                layer.close(layer.index);
                                // window.location.href="addAppVersion?noid=-1";
                            }else {
                                alert("添加失败");
                            }
                        }
                    });
                }, btn2: function (index, layero) {
                    layer.close(layer.index);

                }
            });
        }
//修改APP版本信息
        function updateappversion() {
            var $heheh = $$("#addappversion");
            layer.open({
                title: '修改APP版本信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()
                , anim: 2
                , area: ['6s00px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: ['保存', '返回']
                , btn1: function (index, layero) {
                    var $versionNo= $$(".versionNo").get(1).value;
                    var $versionId= $$(".versionId").get(1).value;
                    var $appId= $$(".appId").get(1).value;
                    var $versionSize = $$(".versionSize").get(1).value;
                    var $versionInfo= $$(".versionInfo").get(1).value;
                    var $apkFileName= $$(".apkFileName").get(1).value;
                    $.ajax({
                        "url": "UpdateAppVersion",
                        "data": {"id":$versionId,"versionNo":$versionNo,"versionSize":$versionSize,"versionInfo":$versionInfo,"apkFileName":$apkFileName,"modifyBy":userId},//请求参数
                        "dataType": "json",  //放回值类型
                        "success": function (data) {
                            if(data>0){
                                alert("修改成功");
                                search()
                                layer.close(layer.index);
                                //    window.location.href="AppInfoId?noid=-1";
                            }else{
                                alert("修改失败");
                            }
                        }
                    });
                }, btn2: function (index, layero) {
                    layer.close(layer.index);

                }
            });

        }

        window.AppVersionlistAppInfo=function (appvid) {
            $.ajax({
                "url": "versionList",
                "data": "appid=" + appvid,//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    if(data>0){
                        window.location.href="backendUser/ShowAppVersionAppInfo?appId="+appvid;
                    }else{
                        alert("还没App有版本信息，请先添加App版本信息");
                    }

                }
            });
        }
//修改App状态
        function UpdateAppInfostatus(appId ,status) {
            $.ajax({
                "url": "backendUser/UpdateAppInfostatus",
                "data": {"appId":appId,"status":status},//请求参数
                "dataType": "json",  //放回值类型
                "success": function (data) {
                    if(data>0){
                        alert("操作成功！");
                        search();
                    }else{
                        alert("操作失败！");
                    }
                }
            });
        }
        function auditing() {
            var $heheh = $$("#addappinfo");
            var $addappversionls=$$("#AppVersionindo");

            layer.open({
                title: '修改APP基础信息&nbsp;&nbsp;<i class="layui-icon layui-icon-friends" style="font-size: 20px; color: #black;"></i>&nbsp;&nbsp; ${devUser.devName}',
                content: $heheh.html()+$addappversionls.html()
                , anim: 2
                , area: ['500px', '650px']
                , resize: false
                , scrollbar: false
                , btnAlign: 'c'
                , btn: ['审核通过','审核未通过','返回']
                , btn1: function (index, layero) {
                    var $appId= $$(".appId").get(1).value;

                    UpdateAppInfostatus($appId,2);
                    layer.close(layer.index);
                }, btn2: function (index, layero) {
                    var $appId= $$(".appId").get(1).value;
                    UpdateAppInfostatus($appId,3);
                    layer.close(layer.index);
                }, btn2: function (index, layero) { layer.close(layer.index);}
            });
        }
    });



</script>


</html>

</div>

<div class="layui-footer">
    <!-- 底部固定区域 -->
    待定
</div>
</div>

<script type="text/javascript" src="${pageContext.request.contextPath}/statics/layui/select.js"></script>

</body>
</html>
